#include "PWMLight.h"
#include "cmsis_os.h"
#include "main.h"
#include "tim.h"

extern uint16_t Compare;
extern uint16_t flag;

void PWMlight_task(void const *pvParameters)
{
    
     while(1)
  {
    __HAL_TIM_SetCompare(&htim1,TIM_CHANNEL_2,Compare);
      
      if (flag == 0)
      {
        Compare -= 10;
          if (Compare == 0)
          {
            flag = 1;
          }
      }
      if (flag == 1)
      {
        Compare += 10;
          if (Compare == 1100)
          {
            flag = 0;
          }
      }
    osDelay(10);
  }

}

